package com.zhixing.web.api.controller;

import com.zhixing.web.api.dataobject.untils.ResultVoUtil;
import com.zhixing.web.api.dataobject.vo.ResultVO;
import com.zhixing.web.service.impl.FileLocalUploadService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;


/**
 * @author dzh
 * @version 1.0.0.05020
 * <p>project: d-blog</p>
 * <p>created time: 2022/05/09 15:32</p>
 * <p>describe: 本地文件上传</p>
 * <p>remarks: </p>
 **/
@RestController
@RequestMapping("/fileLocal")
public class FileLocalUploadController {

    @Resource
    private FileLocalUploadService fileLocalUploadService;

    /**
    * @author dzh
    * @param file 上传文件
    * @return ResultVO
    * <p>时间：2020-08-16 9:14</p>
    * <p>描述：上传车辆照片</p>
    * <p>注意：</p>
    **/
    @PostMapping("/imgUpload")
    public ResultVO carUpload(@RequestParam("file") MultipartFile file) {

        return ResultVoUtil.success(fileLocalUploadService.fileUpload(file, "/img/"));
    }
}
